Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenTelemetry Metrics: Adds support to collect request level metrics #4682

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sourabh1007
Copy link
Contributor

@sourabh1007 sourabh1007 commented Sep 13, 2024

Description

As part of this PR,

  1. Added new flag in CosmosClientTelemetryOptions i.e. IsClientMetricsEnabled, to enable/disable metrics. By default, it would be disabled. (inspired from Java SDK https://github.com/Azure/azure-sdk-for-java/blob/5bc07ca75c7c0520c1098b5a6264258b6e043435/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/models/CosmosClientTelemetryConfig.java#L61)

  2. If Enabled, collecting below metrics:

Name Unit Default Percentiles Description
cosmos.client.op.calls # calls None Number of operation calls
cosmos.client.op.RUs RU (request unit) 95th, 99th + histogram Total request units per operation (sum of RUs for all requested needed when processing an operation)
cosmos.client.op.latency duration (MeterRegistry determines default - usually ms ) 95th, 99th + histogram Total end-to-end duration of the operation
cosmos.client.op.maxItemCount # None For feed operations (query, readAll, readMany, change feed) and batch operations this meter capture the requested maxItemCount per page/request
cosmos.client.op.actualItemCount # None For feed operations (query, readAll, readMany, change feed) batch operations this meter capture the actual item count in responses from the service
cosmos.client.op.regionscontacted # regions None Number of regions contacted when executing an operation

With below dimensions,

Tag/dimension name Sample value Description Scope
Container accountName / databaseName / containerName The fully qualified container name operations + requests
Operation Document / ReadFeed or Document / queryItems / SomeLogicalQueryIdentifier The operation type and for queries with optional logical operation identifier as suffix operations + requests
OperationStatusCode 200 or 429 etc. The status code of the operation reported to the app/svc (could indicate sucess 200 even after hitting errors and retyring successfully) operations + requests
ClientCorrelationId MyClientUsingAADAuth An identifier of the Cosmos client instance - can be specified via the CosmosClientBuilder. clientTelemetryConfig(). clientCorrelationId(String) method or gets auto-generated operations + requests
ConsistencyLevel Eventual, ConsistentPrefix, BoundedStaleness, Strong or Session The consistency level used for the operation operations + requests
PartitionKeyRangeId 1 The partition key range id - an identifier for the physical shard/partition in the backend. This can be helpful to identify whether load is skewed across physical partitions. operations + requests

refer. this for doumentation, https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/cosmos/azure-cosmos/docs/Metrics.md

Type of change

  • [] New feature (non-breaking change which adds functionality)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant